Skip to content

Conversation

@rwaeng
Copy link
Collaborator

@rwaeng rwaeng commented Jan 6, 2026

🔸 작업 내용

🔸 고민 했던 부분

enum vs as const

  • enum 값을 정의할 때 ts의 enum을 사용할지, as const로 선언할지 고민했습니다.
  • as const 사용이 enum을 대체할 수 있고 코드베이스를 JavaScript 표준과 일치시키려는 목적에서 as const 사용이 고려된다고 합니다.
    타입스크립트 핸드북 enums
  • 숫자 기반으로 역으로 매핑할 일이 없을 거 같고, string enum과 비교했을 때는 트리쉐이킹이 된다는 장점이 있다고 판단해서 선택했습니다.

토스 디스커션
티스토리 참고 글

jsonb 사용

  • postgreSQL에 jsonb라는 데이터 타입이 있어서 json과 jsonb를 고민했습니다.
  • jsonb를 선택한 이유는 특정 필드 기준으로 조회할 때 유리하다는 점 때문입니다.
    jsonb는 JSON 데이터를 파싱된 이진 구조로 저장합니다. 그래서 예를 들면 상세 채점 결과의 특정 항목(정확도)을 기준으로 조건 검색이 가능합니다.
  • 객체 키의 순서에 의존해야 하는 특수한 경우를 제외하고 대부분의 애플리케이션에서는 jsonb를 사용하는 것이 권장된다고 합니다.
    postgresql 공식문서
@Column({ name: 'detail_analysis', type: 'jsonb' })
  detailAnalysis: any;
  • 채점 결과 구조가 아직 확정되지 않아서 일단 any로 타입 선언을 했고, 세부 항목이 구체적으로 정해지면 interface로 정의하면 될 것 같습니다.

FK 관계 설정

  • 양방향 관계 설정을 하려다가 역방향 관계가 필요한 경우 그때 선언을 하면 될 거 같아서 FK 소유 기준으로 관계 설정했습니다.

🔸 참고

image

미포함 내용

  • categories 내부 셀프 참조
  • users-answer_submissions 관계 정의

rwaeng added 4 commits January 6, 2026 14:46
- Question, QuestionSolution 엔티티 정의
- AnswerSubmission, AnswerEvaluation 엔티티 정의
- as const를 활용한 공통 상수(Enum 대체) 정의
- question, question-solution, answer-evalutaion, answer-submission 해당
- FK가 있는 쪽에서만 단방향 관계 설정
- answer-submission & audio-assets one to one
- question & category one to one
Copy link
Collaborator

@kimjihyo kimjihyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다! attemptId만 submissionId로 변경하는 것만 결정하면 될 것 같아요 ~!

id: number;

@Column({ name: 'attempt_id', type: 'int' })
attemptId: number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 attemp -> submission으로 테이블 이름이 바뀌었으니까 이것도 submissionId로 할까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오! 좋습니다

Copy link
Collaborator

@swgivenchy swgivenchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!
scoreDetails에서 타입이 확정되는 것은 accuracyEval, logicEval, depthEval 세 가지 등급에 대한 할당 점수가 들어가게 되는 것으로 이해하면 될까요?!

@rwaeng
Copy link
Collaborator Author

rwaeng commented Jan 6, 2026

고생하셨습니다!! scoreDetails에서 타입이 확정되는 것은 accuracyEval, logicEval, depthEval 세 가지 등급에 대한 할당 점수가 들어가게 되는 것으로 이해하면 될까요?!

현재 프롬프트로 생각하면 accuracyEval, logicEval, depthEval, has_application, is_complete_sentence 다섯 가지 기준에 대해서 할당 점수가 들어갈 거 같습니다!

@rwaeng rwaeng merged commit a8b7ca0 into develop Jan 6, 2026
5 checks passed
@rwaeng rwaeng deleted the feature/#104 branch January 6, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERD 기반 Entity 구성 (answer_submissions, answer_evaluations, questions, question_solutions, categories, audio_assets)

4 participants